//
//  YQBaseTableViewController.m
//  WeiboOC
//
//  Created by yang on 15/11/11.
//  Copyright © 2015年 yang. All rights reserved.
//

#import "YQBaseTableViewController.h"
@interface YQBaseTableViewController ()
@end

@implementation YQBaseTableViewController
- (void)loadView
{
   YQUserAccountViewModel *user = [[YQUserAccountViewModel alloc]init];
    self.userLogin = user.userLogin;
    self.userLogin ? [super loadView] : [self loadVisitorLoginView];
}
- (void)loadVisitorLoginView
{
    YQVisitorLoginView* loginView = [[YQVisitorLoginView alloc] init];
    [loginView.loginButton addTarget:self action:@selector(visitorWillLogin) forControlEvents:UIControlEventTouchUpInside];
    [loginView.registerButton addTarget:self action:@selector(visitorWillRegister) forControlEvents:UIControlEventTouchUpInside];
    self.loginView = loginView;
    self.view = loginView;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"登陆" style:UIBarButtonItemStylePlain target:self action:@selector(visitorWillLogin)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(visitorWillRegister)];
}
//登陆
- (void)visitorWillLogin
{
    YQAouthViewController* aouth = [[YQAouthViewController alloc] init];
    UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:aouth];
    [self presentViewController:nav animated:YES completion:nil];
}
//注册
- (void)visitorWillRegister
{
    NSLog(@"visitorWillRegister");
}
@end
